@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="panel panel-default">
                <div class="panel-heading">欢迎登录</div>
                <div class="panel-body">

                    <form class="form-horizontal" role="form" method="POST" action="{{ route('login') }}">
                        {{ csrf_field() }}

                        <div class="form-group{{ $errors->has('phone') ? ' has-error' : '' }}">
                            <label for="tel" class="col-md-4 control-label">请输入账号</label>

                            <div class="col-md-6">
                                <input id="tel" type="tel" class="form-control" name="phone" value="" required autofocus>

                                {{--@if ($errors->has('email'))--}}
                                    {{--<span class="help-block">--}}
                                        {{--<strong>{{ $errors->first('email') }}</strong>--}}
                                    {{--</span>--}}
                                {{--@endif--}}
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
                            <label for="password" class="col-md-4 control-label">请输入密码</label>

                            <div class="col-md-6">
                                <input id="password" type="password" class="form-control" name="password" required>

                                @if ($errors->has('password'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('password') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                       {{-- <div class="form-group{{ $errors->has('phone_code') ? ' has-error' : '' }}">
                            <label for="phone_code" class="col-md-4 control-label">请输入手机验证码</label>

                            <div class="col-md-4">
                                <input id="phone_code" type="text" class="form-control" name="phone_code" required>

                                @if ($errors->has('phone_code'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('phone_code') }}</strong>
                                    </span>
                                @endif
                            </div>
                            <div class="col-md-4">
                                <button class="btn btn-info">发送验证码</button>
                            </div>
                        </div>--}}

                        <div class="form-group{{ $errors->has('captcha') ? ' has-error' : '' }}">
                            <label for="captcha" class="col-md-4 control-label">请输入右图验证码</label>

                            <div class="col-md-2">
                                <input id="captcha" type="text" class="form-control" name="captcha" required>

                                @if ($errors->has('captcha'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('captcha') }}</strong>
                                    </span>
                                @endif
                            </div>
                            <div class="col-md-2">
                                <img src="{{ captcha_src() }}" alt="" id="pic_code">
                            </div>
                            <div class="col-md-2">
                                <a href="javascript:;" class="btn btn-success" onclick="resful()">刷新</a>
                            </div>
                        </div>

                        <script type="application/javascript">
                            function resful() {
                                document.getElementById('pic_code').setAttribute('src','{{ captcha_src() }}&y=' + Math.random());
                            }
                        </script>
                        {{--<div class="form-group">--}}
                            {{--<div class="col-md-6 col-md-offset-4">--}}
                                {{--<div class="checkbox">--}}
                                    {{--<label>--}}
                                        {{--<input type="checkbox" name="remember" {{ old('remember') ? 'checked' : '' }}> 记住我--}}
                                    {{--</label>--}}
                                {{--</div>--}}
                            {{--</div>--}}
                        {{--</div>--}}

                        <div class="form-group">
                            <div class="col-md-6 col-md-offset-4">
                                <button type="submit" class="btn btn-block btn-primary">
                                    登录
                                </button>

                                {{--<a class="btn btn-link" href="{{ route('password.request') }}">--}}
                                    {{--Forgot Your Password?--}}
                                {{--</a>--}}
                            </div>
                        </div>
                    </form>

                    @if (count($errors) > 0)
                        <div class="alert alert-danger">
                            {!! implode('<br>', $errors->all()) !!}
                        </div>
                    @endif
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
